<template>
  <el-dialog :title="title" :visible.sync="open" width="1000px" :close-on-click-modal="false" :show-close="false">
    <el-form ref="form" :model="form" :rules="rules" label-width="90px">
      <el-form-item v-for="field in materialTagList" :key="field.id" :label="field" prop="sort">
        <el-input-number v-model="form.sort" controls-position="right" :min="1" />
      </el-form-item>
    </el-form>
  </el-dialog>
</template>
<script>
import { listMaterialTag } from "@/api/material/materialTag";
export default {
  name: "viewMaterialTag",
  props: {
    open: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      title: '标签预览',
      // 物料标签模板表格数据
      materialTagList: [],
      // 显示项类型字典
      fieldTypeOptions: [],
      // 查询参数
      queryParams: {
        materialId: null,
        categoryId: null,
        fieldType: null,
        orderByColumn: 'sort',
        isAsc: 'asc',
      },
      form: {},
    }
  },
  created() {
    this.getDicts("tag_field_type").then(response => {
      this.fieldTypeOptions = response.data;
    });
  },
  methods: {
    handleOpen() {
      this.getFieldList();
    },
    /** 查询物料标签模板信息 */
    getFieldList() {
      this.loading = true;
      listMaterialTag(this.queryParams).then(response => {
        this.materialTagList = response.rows;

      });
    },
  }
}
</script>